import logging

logging.basicConfig(level=logging.ERROR, format='%(asctime)s - %(levelname)s - %(message)s')

def process_data(data):
    try:
        result = data / 0
    except Exception as e:
        logging.exception("Error occurred while processing data: %s", str(e))

# 测试异常处理与日志记录
if __name__ == "__main__":
    process_data(42)